package xl.model;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

// EmbeddingData.java
public class EmbeddingData {
    private Map<String, Document> vectorStore = new ConcurrentHashMap<>();

    public void addEmbedding(Document doc) {
        vectorStore.put(doc.getId(), doc);
    }

    public List<Document> searchSimilar(List<Double> queryEmbedding, int topK) {
        // 实现余弦相似度计算（此处简化为随机返回）
        return vectorStore.values().stream()
                .limit(topK)
                .collect(Collectors.toList());
    }
}